    window.editsong = function(id,name){
        layer.ready(function(){
            layer.open({
                type: 1,
                title: false,           //不显示标题栏
                closeBtn: 0,            //不显示关闭按钮
                shadeClose: true,       //点击遮罩关闭
                skin: 'yourclass',      //样式类名
                scrollbar: false,       //禁用浏览器
                content: $("#tijiao"),  //弹出内容
                success: function(layero, index) {
                    var mask = $(".layui-layer-shade");
                    mask.appendTo(layero.parent());
                },
            });
        }); 
    };
    (function($) {
        $.fn.extend({
            insertContent: function(myValue, t) {
                var $t = $(this)[0];
                if (document.selection) { //ie
                    this.focus();
                    var sel = document.selection.createRange();
                    sel.text = myValue;
                    this.focus();
                    sel.moveStart('character', -l);
                    var wee = sel.text.length;
                    if (arguments.length == 2) {
                        var l = $t.value.length;
                        sel.moveEnd("character", wee + t);
                        t <= 0 ? sel.moveStart("character", wee - 2 * t - myValue.length) : sel.moveStart("character", wee - t - myValue.length);
      
                        sel.select();
                    }
                } else if ($t.selectionStart || $t.selectionStart == '0') {
                    var startPos = $t.selectionStart;
                    var endPos = $t.selectionEnd;
                    var scrollTop = $t.scrollTop;
                    $t.value = $t.value.substring(0, startPos) + myValue + $t.value.substring(endPos, $t.value.length);
                    this.focus();
                    $t.selectionStart = startPos + myValue.length;
                    $t.selectionEnd = startPos + myValue.length;
                    $t.scrollTop = scrollTop;
                    if (arguments.length == 2) {
                        $t.setSelectionRange(startPos - t, $t.selectionEnd + t);
                        this.focus();
                    }
                }
                else {
                    this.value += myValue;
                    this.focus();
                }
            }
        })
    })(jQuery);

    $(document).ready(function(){
        $("#cancel-reply").click(function(){
            var index = parent.layer.getFrameIndex(window.name); 
            parent.layer.closeAll();
        });
        var b = (new Date).toLocaleTimeString();
    	$(".qiandao").click(function(){
    		$(".Input_text").insertContent('[blockquote]'+b+'签到成功！每日打卡，生活更精彩哦~[/blockquote]');
    		$(this).hide();
    	});
    	$(".good").click(function(){
    		$(".Input_text").insertContent('[blockquote][F01] 赞赞赞，文章真的好赞啊，顶博主！[/blockquote]');
    		$(this).hide();
    	});
    	$(".bad").click(function(){
    		$(".Input_text").insertContent('[blockquote][F14] 狠有亿点看不懂哦，希望下次写的简单易懂一点！[/blockquote]');
    		$(this).hide();
    	});
    	$(".strong").click(function(){
    	    var a = "请输入需要加粗的文字:";
            layer.prompt({formType:0,value:'',title:a,offset:'50%',scrollbar:false,shadeClose:true,closeBtn:0,anim:1}
            ,function(val,index){
                a && (document.getElementById("comment").value = document.getElementById("comment").value + "[strong]" + val + "[/strong]");
                layer.close(index);
            });
    	});
    	$(".em").click(function(){
    	    var a = "请输入需要斜体的文字:";
            layer.prompt({formType:0,value:'',title:a,offset:'50%',scrollbar:false,shadeClose:true,closeBtn:0,anim:1}
            ,function(val,index){
                a && (document.getElementById("comment").value = document.getElementById("comment").value + "[em]" + val + "[/em]");
                layer.close(index);
            });
    	});
    	$(".del").click(function(){
    	    var a = "请输入需要删除线的文字:";
            layer.prompt({formType:0,value:'',title:a,offset:'50%',scrollbar:false,shadeClose:true,closeBtn:0,anim:1}
            ,function(val,index){
                a && (document.getElementById("comment").value = document.getElementById("comment").value + "[del]" + val + "[/del]");
                layer.close(index);
            });
    	});
    	$(".underline").click(function(){
    	    var a = "请输入需要下划线的文字:";
            layer.prompt({formType:0,value:'',title:a,offset:'50%',scrollbar:false,shadeClose:true,closeBtn:0,anim:1}
            ,function(val,index){
                a && (document.getElementById("comment").value = document.getElementById("comment").value + "[u]" + val + "[/u]");
                layer.close(index);
            });
    	});
    	$(".embedImage").click(function(){ 
    	    var a = "请输入图片的 URL 地址（包含https://）:";
            layer.prompt({formType:0,value:'https://',title:a,offset:'50%',scrollbar:false,shadeClose:true,closeBtn:0,anim:1}
            ,function(val,index){
                a && (document.getElementById("comment").value = document.getElementById("comment").value + "[img]" + val + "[/img]");
                layer.close(index);
            });
    	});
    	$(".url1").click(function(){
    	    var a = "请输入链接的 URL 地址（包含https://）:";
            layer.prompt({formType:0,value:'https://',title:a,offset:'50%',scrollbar:false,shadeClose:true,closeBtn:0,anim:1}
            ,function(val,index){
                a && (document.getElementById("comment").value = document.getElementById("comment").value + "[url1]" + val + "[/url1]");
                layer.close(index);
            });
    	});
    	$(".close2 a").click(function() {
    		$(".blackground").fadeOut(100);
    		$(".tijiao").slideUp(300)
    	});
    });
    function b2top(a, b, c) {
    	if (10 >= b && 0 <= b) {
    		var d = 100 * b;
    		$(a).css({
    			backgroundPosition: "0 -" + d + "px"
    		});
    		setTimeout("b2top('" + a + "'," + (c ? b + 1 : b - 1) + "," + c + ")", 50)
    	}
    }
    $(window).scroll(function() {
		200 < $(this).scrollTop() ? $(".backtop").fadeIn() : $(".backtop").fadeOut()
	});
	$(".backtop").hover(function() {
		b2top(".backtop", 0, !0)
	}, function() {
		b2top(".backtop", 3)
	}).click(function() {
		$("body,html").animate({
			scrollTop: 0
		}, 600, function() {});
		b2top(".backtop", 3)
	});
    function grin(a) {
    	var b;
    	a = " " + a + " ";
    	if (document.getElementById("comment") && "textarea" == document.getElementById("comment").type) b = document.getElementById("comment");
    	else return !1;
    	if (document.selection) b.focus(), sel = document.selection.createRange(), sel.text = a, b.focus();
    	else if (b.selectionStart || "0" == b.selectionStart) {
    		var c = b.selectionEnd,
    			d = c;
    		b.value = b.value.substring(0, b.selectionStart) + a + b.value.substring(c, b.value.length);
    		d += a.length;
    		b.focus();
    		b.selectionStart = d;
    		b.selectionEnd = d
    	} else b.value += a, b.focus()
    }
    function size(a) {
    	a.innerHTML = "A" == a.innerHTML ? "A+" : "A+" == a.innerHTML ? "A-" : "A"
    }
    
    function embedSmiley() {
    	"none" == $(".smilebg").css("display") ? $(".smilebg").slideDown(200) : $(".smilebg").slideUp(200)
    }
    $(".smile").click(function() {
		$(".smilebg").slideUp(500)
	});

    function checkLength(a) {
    	if (300 < a.value.length) layer.msg('您填写的评论内容已经超出300个字！',{offset: '50%'}), a.value = a.value.substring(0, 300), !1;
    	a = 300 - a.value.length;
    	document.getElementById("text-all").innerHTML = a.toString();
    	return !0
    }
    function showreply() {
    	$(".form").slideToggle(500, "easeOutExpo")
    }
    function contentReply(pcode,c){
    	var response = document.getElementById('content-post');
    	c.style.display = "none";
    	$("#top-1").css('margin-bottom','100px');
    	$("#content-post").css('margin-top','20px');
    	$("#content-post").css('margin-left','-70px');
    	document.getElementById('content-pcode').value = pcode;
    	document.getElementById('cancel-reply').style.display = '';
    	document.getElementById('cancel-reply-tex').style.display = '';
    	c.parentNode.parentNode.appendChild(response);
    }
    function cancelReply() {
    	var a = document.getElementById("content-place"),
    		b = document.getElementById("content-post");
    	document.getElementById("content-pcode").value = 0;
    	$(".reply a").css({
    		display: ""
    	});
    	document.getElementById("cancel-reply").style.display = "none";
    	document.getElementById('cancel-reply-tex').style.display = 'none';
    	a.appendChild(b)
    }
    function isNum(a) {
    	return /^[0-9]+$/.test(a)
    }
    function get_qqinfo() {
    	if ("" != jQuery("#nickqq").val()) {
    		var a = jQuery("#nickqq").val();
    		isNum(a) ? ($("#qq i,#mail .emailavatar").hide(), $("#qq .emailavatar,#mail i").show(), jQuery("#qq .emailavatar").attr("src", "https://ailcc.com/static/image/loading.gif"), $("#usb").attr("disabled", "disabled"), $("#nickname").val("昵称获取中..."), $.ajax({
    			type: "GET",
    			url: "../static/qq.php?qq=" + a,
    			data: "",
    			cache: !1,
    			dataType: "html",
    			success: function(b) {
    				"" != b ? $("#nickname").val(b) : $("#nickname").val("匿名");
    				$("#usb").removeAttr("disabled")
    			},
    			error: function(b, a, d) {
    				$("#nickname").val("昵称获取失败");
    				$("#usb").removeAttr("disabled")
    			}
    		}), setTimeout(function() {
    			jQuery("#qq .emailavatar").attr("src", "https://q1.qlogo.cn/g?b=qq&nk=" + a + "&s=40")
    		}, 1E3), $("#mail").val(a + "@qq.com"), $("#comurl").val("http://user.qzone.qq.com/" + a)) : ($("#mail .emailavatar,#qq .emailavatar").hide(), $("#mail i,#qq i").show(), $("#nickqq").val(""),alert("QQ号码有误！"))
    	} else $("#qq i").show(), $("#qq .emailavatar").hide()
    }
	$(function() {
		jQuery(function() {
			jQuery("#nickqq").blur(function() {
				get_qqinfo()
			})
		})
	});
	$(function(){
        $(".post-content img").wrap(function(){
            return '<a data-fancybox="portfolio" href="'+ $(this).attr("src") +'"><img src="'+ $(this).attr("src") +'" width="'+ $(this).attr("width") +'" height="'+ $(this).attr("height") +'" title="'+ $(this).attr("title") +'" alt="'+ $(this).attr("alt") +'"></a>';
        });
    });
	$(function() {
		jQuery(function() {
			var a = $(".search input"),
				b = $(".search button"),
				c = $(".search .result"),
				d = $(".search .result div");
			a.focus(function() {
				"输入关键字自动全文搜索..." == a.val() && a.val("")
			});
			a.blur(function() {
				"" == a.val() && (a.val("输入关键字自动全文搜索..."), b.stop().fadeOut())
			});
			a.keydown(function() {
				clearTimeout("t")
			}).keypress(function() {
				clearTimeout("t")
			});
			a.keyup(function() {
				0 < a.val().length ? (b.fadeIn(), 1 < a.val().length && (b.addClass("load"), t = setTimeout(function() {
					d.load("https://ailcc.com/search/search.html?k=" + a.val(), function() {
						c.fadeIn();
						c.find("h2 span").html(a.val());
						b.removeClass("load")
					})
				}, 1E3))) : (b.stop().fadeOut(), c.stop().fadeOut())
			});
			b.click(function() {
				b.stop().fadeOut();
				c.stop().fadeOut()
			});
			c.click(function() {
				c.stop().fadeOut();
				a.val("输入关键字自动全文搜索...");
				b.stop().fadeOut()
			})
		})
	}); 
    layui.use('code', function(){
        layui.code();
    });
    $('*[lay-tips]').on('mouseenter', function(){
        var content = $(this).attr('lay-tips');
        this.index = layer.tips('<div style="padding: -10px; font-size: 14px; color: #fff;">'+ content + '</div>', this, {
            time: -1,
            maxWidth: 280,
            tips: [1, '#000']
        });
    }).on('mouseleave', function(){
        layer.close(this.index);
    });